﻿@using ECG.Common
@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@model List<ProductMenuHomeDto>
@{
    if (Model.Any())
    {
        var count = 0;
    <ul class="top3ProductHot clearfix">
        @foreach (var item in Model)
        {
            var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });            
            count++;
            var clas = "";
            if (count == 2)
            {
                clas = "p3-dotline";
            }
            <li>
                <a href="@pDetailLink">
                    @{
                        if (item.chkType.Equals("o"))
                        {
                            <div class="p3-title">MUA NHIỀU</div>
                        }
                        else if (item.chkType.Equals("p"))
                        {
                            <div class="p3-title">KHUYẾN MẠI</div>
                        }
                        else
                        {
                            <div class="p3-title">HOT</div>
                        }
                    }
                    <div class="p3-itemBox @clas">
                        <div class="p3-img">
                            <img src="@item.ImagePath.ImagePathThumb(188, 188)" width="188" height="188" alt="@item.Name" class="img-loading" />
                        </div>
                        <div class="p3-name">
                            <h4>@item.Name</h4>
                        </div>
                        @if (item.PromotionPrice > 0)
                        {
                            <div class="p3-price-root">
                                <span class="p3-priceOld">@item.Price.ToString("##,###,###") <sup>đ</sup></span>
                                <span class="p3-punit">[-@item.DiscountPercentage%]</span>
                            </div>
                            <div class="p3-price-mo">@item.PromotionPrice.ToString("##,###,###") <sup>đ</sup></div>
                        }
                        else
                        {
                            <div class="p3-price-mo">@item.Price.ToString("##,###,###") <sup>đ</sup></div>
                        }
                    </div>
                </a>
            </li>
        }

    </ul>
    }
}
<div class="p3-new clearfix">
    @{
        var _model = ViewBag.Top4NewProductCate as List<ProductMenuHomeDto>;
        if (_model.Any())
        {
        <ul class="p3-p-new clearfix">
            @foreach (var item in _model)
            {
                var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
                <li>
                    <i class="icon-new-p"></i>
                    <div class="pp3-line">
                        <a href="@pDetailLink" title="@item.Name">
                            <div class="pp3-img">
                                <img src="@item.ImagePath.ImagePathThumb(95, 85)" width="95" height="85" class="img-loading" />
                            </div>
                            <div class="pp3-name"><h5>@item.Name</h5></div>
                            @if (item.PromotionPrice > 0)
                            {
                                <div class="pp3-price">@item.PromotionPrice.ToString("##,###,###")đ</div>
                            }
                            else
                            {
                                <div class="pp3-price">@item.Price.ToString("##,###,###")đ</div>
                            }
                            <div class="pp3-order">
                                <a href="" class="pp3-lnk">Đặt hàng</a>
                            </div>
                        </a>
                    </div>
                </li>
            }
        </ul>
        }
    }

    <div class="p3-adv1 clearfix">
        @Html.Action("Adv1ByCategory", "CategoryL1", new { category = ViewBag.CategoryId , w = 260, o = 1 })
        @*<a href="#">
            <img src="" width="260" height="148" />
        </a>*@
    </div>
</div>
